<%@page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>

<% 
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getLocalName()+":"+request.getLocalPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript">	
	var flag = true;	//定义一个 标记变量
		//打开采购单明细
		function openPomain(){
			$("#somain_tab").hide();
			$("#pomain_tab").show();
		}
		//打开销售单明细
		function openSomain(){
			$("#pomain_tab").hide();
			
			$("#somain_tab").show();
		}
		
		var pageNo = $("#cpageNo").val();
		function selectPage(){
			var value = $("#selectPage").val();
			goPage(value)
		}
		$("#selectPage").val(pageNo);
</script>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
	<tr>
		<td nowrap class="title1">明细信息</td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
	<tr>
		<td width="10px" class="toolbar" onMouseOver="OMO(event)" onMouseOut="OMOU(event)" onclick="openSomain()">销售单明细</td>
		<td width="10px" class="toolbar" onMouseOver="OMO(event)" onMouseOut="OMOU(event)" onclick="openPomain()">采购单明细</td>
		<td width="80px" class="toolbar">&nbsp;</td>
	</tr>
</table>
</div>
<div id="somain_tab">
<table width="100%" border="0" align="center" cellspacing="1" class="c">
	<tr>
		<td class="title1">销售单号</td>
		<td class="title1">销售单日期</td>
		<td class="title1">收款日期</td>
		<td class="title1">收款金额</td>
		<td class="title1">收款人</td>
		<td class="title1">订单状态</td>
	</tr>
	<!-- <tbody id="t">
    	
    </tbody> -->
	<c:forEach items="${page_so.dataList }" var="so">
		<tr ondblclick="showDetail(${so.soId},this)">
			<td align="center">${so.soId }</td>
			<td align="center">${so.createTime }</td>
			<td align="center">
				<c:if test="${so.payType == '货到付款' || so.payType=='款到发货'}">${so.payTime }</c:if>
				<c:if test="${so.payType == '预付款到发货'}">${so.prePayTime }</c:if>
			</td>
			<td align="center">${so.poTotal}</td>
			<td align="center">
				<c:if test="${so.payType == '货到付款' || so.payType == '款到发货' }">${so.payUser }</c:if>
				<c:if test="${so.payType == '预付款到发货'}">${so.prePayUser }</c:if>
			</td>
			<td align="center">
				<c:if test="${so.status ==1 }">新增</c:if>
				<c:if test="${so.status ==2 }">已付款</c:if>
				<c:if test="${so.status ==3 }">已预付</c:if>
				<c:if test="${so.status ==4 }">已入库</c:if>
				<c:if test="${so.status ==5 }">已了结</c:if>
			</td>
		</tr>
		<tr style="display:none">
			<td colspan="11" name="detail"></td>
		</tr>
	</c:forEach>
</table>
<%--导入分页层 --%>
<div class="pageDiv">
	当前第<span id="currentPage">${page_so.currentPage}</span>页
	<c:if test="${page_so.currentPage == 1}">
		<input type="button" value="首页" disabled="disabled"/>
		
		<input type="button" value="上一页" disabled="disabled"/>
	</c:if>
	<c:if test="${page_so.currentPage != 1}">
		<input type="button" value="首页" onclick="goPage(1)"/>
		<input type="button" value="上一页" onclick="goPage(${page_so.currentPage-1})"/>
	</c:if>
	<c:if test="${page_so.currentPage == page_so.totalPage}">
		<input type="button" value="下一页" disabled="disabled"/>
		<input type="button" value="末页" disabled="disabled"/>
	</c:if>
	<c:if test="${page_so.currentPage != page_so.totalPage}">
		<input type="button" value="下一页" onclick="goPage(${page_so.currentPage+1})"/>
		<input type="button" value="末页" onclick="goPage(${page_so.totalPage})"/>
	</c:if>
	<input type="hidden" value="${page_so.currentPage }" id="cpageNo">
	<select id="selectPage" onchange="selectPage()">
		<c:forEach begin="1" end="${page_so.totalPage }" var="mypage">
			<option value="${mypage }" id="option">第${mypage }页</option>
		</c:forEach>
	</select>
	共${page_so.totalPage}页 ${page_so.totalSize }条记录
</div>
</div>

<div id="pomain_tab" style="display: none">
<table width="100%" border="0" align="center" cellspacing="1" class="c">
	<tr>
		<td class="title1">采购单号</td>
		<td class="title1">采购单日期</td>
		<td class="title1">付款日期</td>
		<td class="title1">付款金额</td>
		<td class="title1">支付人</td>
		<td class="title1">采购单状态</td>
	</tr>
	<c:forEach items="${page_po.dataList }" var="po">
		<tr ondblclick="showDetail(${po.poId},this)">
			<td align="center">${po.poId }</td>
			<td align="center">${po.createTime }</td>
			<td align="center">
				<c:if test="${po.payType == '货到付款' || po.payType== '款到发货' }">${po.payTime }</c:if>
				<c:if test="${po.payType == '预付款到发货' }">${po.prePayTime }</c:if>
			</td>
			<td align="center">${po.poTotal}</td>
			<td align="center">
				<c:if test="${po.payType == '货到付款' || po.payType=='款到发货'}">${po.payUser }</c:if>
				<c:if test="${po.payType == '预付款到发货'}">${po.prePayUser }</c:if>
			</td>
			<td align="center">
				<c:if test="${po.status ==1 }">新增</c:if>
				<c:if test="${po.status ==2 }">已付款</c:if>
				<c:if test="${po.status ==3 }">已预付</c:if>
				<c:if test="${po.status ==4 }">已入库</c:if>
				<c:if test="${po.status ==5 }">已了结</c:if>
			</td>
		</tr>
		<tr style="display:none"><td colspan="11" name="detail"></td></tr>
	</c:forEach>
</table>
<%--导入分页层 --%>
<div class="pageDiv">
	当前第<span id="currentPage">${page_po.currentPage}</span>页
	<c:if test="${page_po.currentPage == 1}">
		<input type="button" value="首页" disabled="disabled"/>
		
		<input type="button" value="上一页" disabled="disabled"/>
	</c:if>
	<c:if test="${page_po.currentPage != 1}">
		<input type="button" value="首页" onclick="goPage(1)"/>
		<input type="button" value="上一页" onclick="goPage(${page_po.currentPage-1})"/>
	</c:if>
	<c:if test="${page_po.currentPage == page_po.totalPage}">
		<input type="button" value="下一页" disabled="disabled"/>
		<input type="button" value="末页" disabled="disabled"/>
	</c:if>
	<c:if test="${page_po.currentPage != page_po.totalPage}">
		<input type="button" value="下一页" onclick="goPage(${page_po.currentPage+1})"/>
		<input type="button" value="末页" onclick="goPage(${page_po.totalPage})"/>
	</c:if>
	<input type="hidden" value="${page_po.currentPage }" id="cpageNo">
	<select id="selectPage" onchange="selectPage()">
		<c:forEach begin="1" end="${page_po.totalPage }" var="mypage">
			<option value="${mypage }" id="option">第${mypage }页</option>
		</c:forEach>
	</select>
	共${page_po.totalPage}页 ${page_po.totalSize }条记录
</div>
</div>
